package com.zhouyibike.uu.utils;

import android.content.Context;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;

/**
 * Created by Zy on 2017/10/17.
 */
public  class EditUtils {

    public static void seteditopen(EditText editText) {
        try {
            editText.setFocusable(true);

            editText.setFocusableInTouchMode(true);

            editText.requestFocus();

            InputMethodManager inputManager =

                    (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

            inputManager.showSoftInputFromInputMethod(editText.getWindowToken(), 0);
        } catch (Exception e) {

        }
    }
    public static void seteditclose(EditText editText) {
        try {
            editText.setFocusable(true);

            editText.setFocusableInTouchMode(true);

            editText.requestFocus();

            InputMethodManager inputManager =

                    (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

            inputManager.hideSoftInputFromInputMethod(editText.getWindowToken(), 0);
        } catch (Exception e) {

        }
    }
}
